#ifndef MEMODETAILINFOWIDGET_H
#define MEMODETAILINFOWIDGET_H

#include <QWidget>
#include <QtSql>

namespace Ui {
    class MemoDetailInfoWidget;
}

class MemoDetailInfoWidget : public QWidget {
    Q_OBJECT

public:
    enum WidgetType{EDITABLE = 0, UNEDITABLE};

public:
    MemoDetailInfoWidget(QSqlDatabase _db,
                         QString _strMemoID,
                         WidgetType _WidgetType,
                         QWidget* parent = 0);
    ~MemoDetailInfoWidget();

protected:
    void changeEvent(QEvent *e);

private:
    Ui::MemoDetailInfoWidget *ui;

//--------------------------------------------------
public:
    void updateComboxMemoLabel();
    bool addNewRecord();
    bool deleteRecord();
    bool updateRecord();
    bool deleteAlarm();
    QString getID();
private:
    QSqlDatabase m_SqlDB;
    QString m_strMemoID;
    QSqlQueryModel* m_pComboxSqlQueryModel;

    QSqlQueryModel* m_pAlarmQueryModel;

    QSqlTableModel* m_pRecoedModel;

private:
    void initUI(WidgetType _WidgetType);
public slots:
    void fillDate(QString _strMemoID);

signals:
    void AlarmTableChanged();
    void ActiveMemoTableChanged();
//    void clear();

};

#endif // MEMODETAILINFOWIDGET_H
